package com.group.service.impl;

import com.group.pojo.Product;
import com.group.mapper.ProductMapper;
import com.group.service.ProductService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author group
 * @since 2021-09-06
 */
@Service
public class ProductServiceImpl implements ProductService {

    @Autowired
    private ProductMapper productMapper;

    @Override
    public List<Product> selectProductList(Product product) {
        return productMapper.selectProductList1(product);
    }

    @Override
    public List<Product> productClassification(String type) {
        return productMapper.productClassification1(type);
    }

    @Override
    public Product findProductById(int id) {
        return productMapper.findProductById1(id);
    }

    @Override
    public boolean addProduct(Product product) {
        if (productMapper.addProduct1(product) > 0) {
            return true;
        } else {
            return false;
        }
    }

    @Override
    public boolean updateProduct(Product product) {
        if (productMapper.updateProduct1(product) > 0) {
            return true;
        } else {
            return false;
        }
    }

    @Override
    public boolean deleteProducts(int[] ids) {
        if (productMapper.deleteProducts1(ids) > 0) {
            return true;
        } else {
            return false;
        }
    }

    @Override
    public List<Product> getProduct() {
        return productMapper.getAllProduct1();
    }


}
